package com.baor.controller;

import com.baor.domain.DistributorVo;
import com.baor.service.DistributorService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/distributor")
public class DistributorController {

    @Autowired
    private DistributorService distributorService;

    @RequestMapping("selectList")
    public AjaxResult<?> selectList(@RequestBody Map<String, Object> param){
        return distributorService.selectList(param);
    }

    @RequestMapping("search")
    public AjaxResult<?> search(@RequestBody Map<String, Object> param) {
        return distributorService.selectList(param);
    }

    @RequestMapping("freeze")
    public AjaxResult<?> freeze(@RequestBody DistributorVo  vo) {
        return distributorService.freeze(vo.getDistributorId());
    }

    @RequestMapping("updatelevel")
    public AjaxResult<?> updatelevel(@RequestBody DistributorVo  vo) {
        return distributorService.updatelevel(vo);
    }

    @RequestMapping("choose")
    public AjaxResult<?> choose(@RequestBody Map<String, Object> param){
        return distributorService.selectList(param);
    }

    @RequestMapping("updateSuperior")
    public AjaxResult<?> updateSuperior(@RequestBody DistributorVo  vo) {
        return distributorService.updateSuperior(vo);
    }

    @RequestMapping("insert")
    public AjaxResult<?> insert(@RequestBody DistributorVo  vo) {
        return distributorService.insert(vo);
    }

    @RequestMapping("details")
    public AjaxResult<?> details(@RequestBody Map<String, Object> param) {
        return distributorService.details(param);
    }

    @RequestMapping("teamInfo")
    public AjaxResult<?> teamInfo(@RequestBody Map<String, Object> param) {
        return distributorService.teamInfo(param);
    }

    @RequestMapping("record")
    public AjaxResult<?> record(@RequestBody Map<String, Object> param) {
        return distributorService.record(param);
    }

    @RequestMapping("chooseVip")
    public AjaxResult<?> chooseVip(@RequestBody Map<String, Object> param) {
        return distributorService.chooseVip(param);
    }

    @RequestMapping("chooseDistributor")
    public AjaxResult<?> chooseDistributor(@RequestBody Map<String, Object> param) {
        return distributorService.chooseDistributor(param);
    }

}
